<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			
		
			// var longstr = "abcdef大家好，我是梁家辉，我今年18";
			var longstr = "ABCDEF大家好，我是梁家辉，我今年18";
			
			//获取字符串的长度
			console.log("longstr.length: "+longstr.length)
			
			//charat 索引从零开始 返回指定索引位置的字符
			//charCodeAt() 返回指定索引位置字符的 Unicode 值
			
			console.log("longstr.charAt(0) : "+longstr.charAt(0) + "\t"+longstr.charCodeAt(0))
			console.log("longstr.charAt(1) : "+longstr.charAt(1) + "\t"+longstr.charCodeAt(1))
			console.log("longstr.charAt(2) : "+longstr.charAt(2) + "\t"+longstr.charCodeAt(2))
			console.log("longstr.charAt(3) : "+longstr.charAt(3) + "\t"+longstr.charCodeAt(3))
			console.log("longstr.charAt(4) : "+longstr.charAt(4) + "\t"+longstr.charCodeAt(4))
			
			
			//concat  连接两个或多个字符串，返回连接后的字符串,产生新字符串
			
			var str1 = "hello ";
			var str2 = "javascript";
			//产生新的字符串
			var str3 = str1.concat(str2);
			console.log("str1: "+str1);
			console.log("str2: "+str2);
			console.log("str3: "+str3);
			
			//fromCharCode
			console.log("String.fromCharCode(65): "+ String.fromCharCode(65))
			
			
			//indexOf 
			var str4 = "hello world";
			console.log("str4: "+str4);
			console.log("str4.indexOf('o') : "+str4.indexOf('o'));
			console.log("str4.lastIndexof('o') : "+str4.lastIndexOf('o'));
			
			// slice( start ,end )
			//substr(start , len)
			console.log("str4.substr(0,5): "+str4.substr(0,5));
			console.log("str4.substr(0,6): "+str4.substr(0,6));
			console.log("str4.substr(-2,6): "+str4.substr(-2,6)); //ld
			console.log("str4.substr(-2,1): "+str4.substr(-2,1));  // l
				
			console.log("str4.slice(0,5): "+str4.slice(0,5));
			console.log("str4.slice(0,6): "+str4.slice(0,6));
			
			console.log("str4.slice(-10,5): "+str4.slice(-10,5));
			
			var str5 = "Hello World!";
			console.log("str5: "+str5);
			console.log("str5.toLowerCase(): "+str5.toLowerCase())
			console.log("str5: "+str5);
			console.log("str5.toUpperCase(): "+str5.toUpperCase())
					
		</script>
	</head>
	<body>
		
		
		
		
		
		
		
	</body>
</html>
